package com.jingtai.platform.controller.merchants;

import com.jingtai.core.entity.member.MemberCar;
import com.jingtai.platform.service.merchants.MemberCarService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 用户购物车表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:33
 */
@Validated
@RestController
@RequestMapping("/platform/membercar")
@Api(tags = "用户购物车表")
public class MemberCarController{

    @Autowired
    private MemberCarService memberCarService;


    @ApiOperation("用户购物车表列表查询")
    @GetMapping("/list")
    public ResultUtil aopMemberCarList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return memberCarService.MemberCarlist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询memberCar实体")
    @GetMapping("/getMemberCarById")
    public ResultUtil GetMemberCarById(@CApiParam(name = "id",value = "memberCar实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return memberCarService.getMemberCarById(id);
    }


    @ApiOperation("新增memberCar实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"memberCar.id","memberCar.createTime","memberCar.updateTime","memberCar.deleteFlag"})
    public ResultUtil aopAddMemberCar(@RequestBody @Validated MemberCar memberCar){
        return memberCarService.addMemberCar(memberCar);
    }

    @ApiOperation("编辑memberCar实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"memberCar.createTime","memberCar.updateTime","memberCar.deleteFlag"})
    public ResultUtil aopEditMemberCar(@RequestBody @Validated MemberCar memberCar){
        return memberCarService.editMemberCar(memberCar);
    }

    @ApiOperation("根据ID删除memberCar实体")
    @GetMapping("/delMemberCarById")
    public ResultUtil aopDelMemberCarById(@CApiParam(name = "id",value = "memberCar实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return memberCarService.delMemberCarById(id);
    }

}






